<html>
<head>
<TITLE>Internal System</TITLE>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<LINK href="../css/style.css" type=text/css rel=stylesheet>
</head>

<body bgcolor="#FFFFFF" text="#000000">

  <table width="100%" height="23" cellspacing="0" cellpadding="2">
    <tr bgcolor="#E4E4E4"> 
      <td width="15%">&nbsp;Product Images</td>
      <td width="70%"><font color="#FF0000">&nbsp;{$error_message}</font></td>
      <td width="10%" align="right">&nbsp;<A href="{$backurl}" target="_self">Back</A>&nbsp;&nbsp;</td>
    </tr>
    
	{foreach item=data key=attributeID from=$arrAllImage}
         <tr bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor='#E9EDED';" onMouseOut="this.style.backgroundColor='#FFFFFF'"> 
	      <td height="23" align="right">Image of {$data.attributeName}:</td>
	      <td height="23" colspan="2">&nbsp;
	      
		      <table width="100%" cellspacing="0" cellpadding="2">
		      	{foreach item=image key=key from=$data.imageIDs}
				    <tr> 
				      <td width="15%" align="right">&nbsp;<img src="../pic/thumbnail.php?width=100&height=100&fileName={$image.imageID}.{$image.imageExt}" border="0"></td>
				      <td width="85%" align="left"><font color="#FF0000">&nbsp;<form method="get" action="">
				      	<A href="?action=delete&menuGid={$menuGid}&menuid={$menuid}&imageid={$image.imageID}&id={$id}&backurl_base64={$backurl_base64}" target="_self">Delete</A>&nbsp;&nbsp;|&nbsp;&nbsp;
				      	{if $image.isMain == 'yes'}
				      		<A href="?action=setMain&menuGid={$menuGid}&menuid={$menuid}&piid={$image.id}&id={$id}&ismain=no&backurl_base64={$backurl_base64}" target="_self">Set Minor</A>
				      	{else}
				      		<A href="?action=setMain&menuGid={$menuGid}&menuid={$menuid}&piid={$image.id}&id={$id}&ismain=yes&backurl_base64={$backurl_base64}" target="_self">Set Main</A>
				      	{/if}
				      	
				      	&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;&nbsp;
				      		<input type="submit" name="action" value="Charge Color To">
				      		<select name="changeAttributeID">
				      			{foreach item=data from=$arrAttributes}
				      				{if $changeAttributeID == $data.attributeID}
				      					<option value="{$data.attributeID}" selected="selected">{$data.name}</option>
				      				{else}
				      					<option value="{$data.attributeID}">{$data.name}</option>
				      				{/if}
				      			{/foreach}
				      		</select>
				      		
				      		<input name="piid" type="hidden" value="{$image.id}">
				      		<input name="backurl_base64" type="hidden" value="{$backurl_base64}">
				      		<input name="menuGid" type="hidden" id="menuGid" value="{$menuGid}">
				    		<input name="menuid" type="hidden" id="menuid" value="{$menuid}">
				    		<input name="id" type="hidden" id="id" value="{$id}">
				    		<input name="backurl" type="hidden" id="backurl" value="{$backurl}">
				      		
				      	</form>
				      	</font>
				      </td>
				    </tr>
			    {/foreach}
			    	
			  </table>
	          </td>
	    </tr>
 	{/foreach}
 	{if $arrExistedImage|@count > 0}
 	<tr bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor='#E9EDED';" onMouseOut="this.style.backgroundColor='#FFFFFF'"> 
	      	<td height="23" align="right">Existed Images:</td>
	      	<td height="23" colspan="2">
	      		<form method="post" action="">
	      			{foreach item=data key=imageid from=$arrExistedImage}
	      				<img src="../pic/thumbnail.php?width=100&height=100&fileName={$imageid}.{$data}" border="0">
			      		<input name="existedImages[]" type="hidden" value="{$imageid}">
			      	{/foreach}
			      	<input name="attributeIDRepeat" type="hidden" value="{$attributeIDRepeat}">
			      	
			      	<input type="submit" name="action" value="Use Existed Images">
			      	
			      	<input name="menuGid" type="hidden" id="menuGid" value="{$menuGid}">
				    <input name="menuid" type="hidden" id="menuid" value="{$menuid}">
				    <input name="id" type="hidden" id="id" value="{$id}">
				    <input name="backurl" type="hidden" id="backurl" value="{$backurl}">
			    </form>
			</td>
	    </tr>
	    <tr bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor='#E9EDED';" onMouseOut="this.style.backgroundColor='#FFFFFF'"> 
	      	<td height="50" align="right">&nbsp;</td>
	      	<td height="23" colspan="2">
	    </td>
	    </tr>
	{/if}
	{foreach item=data from=$arrAttributes}
         <tr bgcolor="#FFFFFF" onMouseOver="this.style.backgroundColor='#E9EDED';" onMouseOut="this.style.backgroundColor='#FFFFFF'"> 
	      	<td height="23" align="right">{$data.name} Color:</td>
	      	<td height="23" colspan="2">
	      		<form method="post" action="" enctype="multipart/form-data">
			      	<input name="image[]" type="file" size="45">
			      	
			      	<input name="attributeID" type="hidden" id="attributeID" value="{$data.attributeID}">
			      	
			      	<input type="submit" name="action" value="Upload">
			      	
			      	<input name="menuGid" type="hidden" id="menuGid" value="{$menuGid}">
				    <input name="menuid" type="hidden" id="menuid" value="{$menuid}">
				    <input name="id" type="hidden" id="id" value="{$id}">
				    <input name="backurl" type="hidden" id="backurl" value="{$backurl}">
			    </form>
			</td>
	    </tr>
	 {/foreach}
  </table>

</body>
</html>